<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<script type="text/javascript" src="/static/admin/echarts/echarts.min.js"></script>
<style>
    .ttt{background-color: #FFFFFF;min-height: 800px;padding: 10px 0;}
    .nei .zuo{float: left;width: calc(65% - 20px);padding-right: 20px}
    .nei .you{float: left;width: calc(35% - 20px);padding-right: 20px}
    .nei .ddbt{font-weight: 700;font-size: 20px;color: #1CA5FF;padding-left: 20px;}
    .nei .xxbt{font-weight: 700;font-size: 16px;padding-bottom: 10px}
    .nei .zuo .xkk{height: 70px;width: calc(25% - 22px);margin-left:20px;border: 1px solid #eee;border-radius: 10px;float: left;position: relative}
    .nei .zuo .tu{width: 30px;height: 30px;position: absolute;left: 30px;top: 20px;}
    .nei .zuo .w1{padding-left: 70px;color: #777;margin-top: 12px}
    .nei .zuo .w2{padding-left: 70px;font-size: 20px;font-weight: 700;}
    .nei .zuo .erhbb{margin-top: 20px}
    .nei .zuo .erh{float: left;margin-left: 20px;width: calc(50% - 22px);}
    .nei .zuo .qqtt{border: 1px solid #eee;border-radius: 10px;height: 220px;}
    .nei .zuo .qtzhan{height: 100px;overflow: hidden;margin-top: 50px;position: relative}
    .nei .zuo .qtzhan div{padding-left: 60px}
    .nei .zuo .qtzhan span{position: relative;top:2px;left:-7px;display: inline-block;width: 15px;height: 15px;}
    .float-l{float: left}
    .wd50{width: 50%}
    .layui-table-tool{display: none}
    .tipss{cursor: pointer;}
</style>
<body class="laytp-container" style="padding: 10px">
<div class="layui-card" id="search-form" style="margin: 0;box-shadow:unset">
    <div class="layui-card-body">
<!--        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">-->
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">年度</label>
                        <div class="layui-input-block">
                            <input type="text" id="year" placeholder="请输入" autocomplete="off" class="layui-input bdate_sea_y">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">所属单位</label>
                        <div class="layui-input-block">
                            <div id="chanid" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="listSeaZuo"><i class="layui-icon layui-icon-search"></i>查询</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
<!--        </form>-->
    </div>
</div>
<div class="ttt">
    <div class="nei">
        <div class="zuo">
            <div class="ddbt">年度概况</div>
            <div>
                <div class="xkk">
                    <img class="tu" src="/static/admin/images/entong.png">
                    <div class="w1"><span class="tipss tipss_1">年度投标项目总数</span></div>
                    <div class="w2 niantounum">0</div>
                </div>
                <div class="xkk">
                    <img class="tu" src="/static/admin/images/entong.png">
                    <div class="w1"><span class="tipss tipss_2">年度预计工程造价总额(元)</span></div>
                    <div class="w2 nianzaofee">0</div>
                </div>
                <div class="xkk">
                    <img class="tu" src="/static/admin/images/entong.png">
                    <div class="w1"><span class="tipss tipss_3">年度中标项目数</span></div>
                    <div class="w2 nianwinnum">0</div>
                </div>
                <div class="xkk">
                    <img class="tu" src="/static/admin/images/entong.png">
                    <div class="w1"><span class="tipss tipss_4">年度中标总额(元)</span></div>
                    <div class="w2 nianwinfee">0</div>
                </div>
                <div style="clear: both"></div>
            </div>
            <div class="erhbb">
                <div class="erh">
                    <div class="xxbt "><span class="tipss tipss_5">项目类型-工程造价</span></div>
                    <div class="qqtt">
                        <div class="wd50 float-l" id="zi_chart_xmlxgczj" style="height: 220px"></div>
                        <div class="wd50 float-l qtzhan xmlxgczj_list"></div>
                    </div>
                </div>
                <div class="erh">
                    <div class="xxbt "><span class="tipss tipss_6">项目属性-工程造价</span></div>
                    <div class="qqtt">
                        <div class="wd50 float-l" id="zi_chart_xmsxgczj" style="height: 220px"></div>
                        <div class="wd50 float-l qtzhan xmsxgczj_list"></div>
                    </div>
                </div>
                <div style="clear: both"></div>
            </div>
            <div style="clear: both"></div>
            <div style="margin-top: 20px">
                <div class="xxbt " style="padding-left: 20px"><span class="tipss tipss_7">本年度中标项目</span></div>
                <div class="table-box tablenes" style="padding-left: 20px">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
        <div class="you">
            <div class="ddbt">投标预警</div>
            <div style="margin-top: 20px">
                <div class="xxbt" style="padding-left: 20px">本月投标截止项目</div>
                <div class="table-box tablenes" style="padding-left: 20px">
                    <table id="datalist_tou" lay-filter="datalist_tou"></table>
                </div>
            </div>
            <div >
                <div class="xxbt" style="padding-left: 20px">本月即将开标项目</div>
                <div class="table-box tablenes" style="padding-left: 20px">
                    <table id="datalist_kai" lay-filter="datalist_kai"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    const colors = ['#5470C6', '#FAC858', '#91CC75', '#73C0DE', '#FD7E55', '#E87BCA', '#3BA272', '#EE6666'];
    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;


        $("#listSeaZuo").click(function () {
            var year = $("#year").val();
            var chanid = $("input[name='chanid']").val();
            func_engin_tongtou_zuo(year, chanid);
            func_engin_tongtou_you(chanid);
        });



        func_engin_tongtou_zuo();
        function func_engin_tongtou_zuo(year='', chanid='') {
            facade.ajax({url: ask_engin_tongtou_zuo_list, data:{year: year, chanid:chanid}}).done(function(res){
                if (res.code === 2000) {
                    var data = res.data;
                    $(".niantounum").text(data.niantounum);
                    $(".nianzaofee").text(parseFormatNum(data.nianzaofee));
                    $(".nianwinnum").text(data.nianwinnum);
                    $(".nianwinfee").text(parseFormatNum(data.nianwinfee));

                    zi_chart_xmlxgczj('zi_chart_xmlxgczj', data.xmlxgczj);
                    var xmlxgczjStr = '';
                    for (var mmm in data.xmlxgczj){
                        if(mmm <=5){
                            xmlxgczjStr += '<div>';
                            xmlxgczjStr += '<span style="background-color: '+colors[mmm]+';"></span>';
                            xmlxgczjStr += data.xmlxgczj[mmm].name+'（'+data.xmlxgczj[mmm].num+'）：'+parseFormatNum(data.xmlxgczj[mmm].value)+'</div>'
                        }
                    }
                    $(".xmlxgczj_list").html(xmlxgczjStr)


                    zi_chart_xmsxgczj('zi_chart_xmsxgczj', data.xmsxgczj);
                    var xmsxgczjStr = '';
                    for (var nnn in data.xmsxgczj){
                        if(nnn <=5){
                            xmsxgczjStr += '<div>';
                            xmsxgczjStr += '<span style="background-color: '+colors[nnn]+';"></span>';
                            xmsxgczjStr += data.xmsxgczj[nnn].name+'（'+data.xmsxgczj[nnn].num+'）：'+parseFormatNum(data.xmsxgczj[nnn].value)+'</div>'
                        }
                    }
                    $(".xmsxgczj_list").html(xmsxgczjStr)



                    $("#year").val(res.data.is_year);
                    xmselect_dan('chanid', res.data.chanid, res.data.is_chanid)


                    var mytable = table.render({
                        elem: "#datalist",id: "datalist"
                        ,data: res.data.winlist,where: {}, page: false, height: '360',limit:9999999
                        ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
                        ,defaultToolbar: ['','',''],filter: TabInit.filter
                        ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
                        ,text: TabInit.text
                        ,parseData: function (res) {

                            render_from();
                            return {
                                "code": res.code,
                                "msg": res.message,
                                "count": res.data.data.total,
                                "data": res.data.data.data
                            };
                        }
                        , cols: [[
                            {type:'numbers',title:'序号',fixed:'left'}
                            ,{field:'name',title:'项目名称',templet: function(d){
                                    return '<span class="colorlan" onclick="openPage(\'../engin/show.php?id='+d.id+'\')">'+d.name+'</span>';
                                }}
                            ,{field: 'state_name', title: '项目状态'}
                            ,{field: 'engintype_name', title: '项目类型'}
                            ,{field: 'business_name', title: '项目属性'}
                            ,{field: 'winfee', title: '中标金额(元)',align:'right',totalRow: true,templet: function(d){return parseFormatNum(d.winfee);}}
                            ,{field: 'windt', title: '中标日期'}
                            ,{field: 'chanid_name', title: '所属单位'}
                        ]]
                        , done: function (res) {
                            soulTable.render(this);
                            $(".layui-table-view").attr('height','unset');
                        }
                    });



                    render_from();
                }
            });
        }


        func_engin_tongtou_you();
        function func_engin_tongtou_you(chanid='') {
            facade.ajax({url: ask_engin_tongtou_you_list, data:{chanid:chanid}}).done(function(res){
                if (res.code === 2000) {
                    var toumytable = table.render({
                        elem: "#datalist_tou",id: "datalist_tou"
                        ,data: res.data.tou,where: {}, page: false, height: '313',limit:9999999
                        ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
                        ,defaultToolbar: ['','',''],filter: TabInit.filter
                        ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
                        ,text: TabInit.text
                        ,parseData: function (res) {

                            render_from();
                            return {
                                "code": res.code,
                                "msg": res.message,
                                "count": res.data.data.total,
                                "data": res.data.data.data
                            };
                        }
                        , cols: [[
                            {type:'numbers',title:'序号',fixed:'left'}
                            ,{field:'name',title:'项目名称',templet: function(d){
                                    return '<span class="colorlan" onclick="openPage(\'../engin/show.php?id='+d.id+'\')">'+d.name+'</span>';
                                }}
                            ,{field: 'enddt_tou', title: '投标截止时间'}
                        ]]
                        , done: function (res) {
                            soulTable.render(this);
                            $(".layui-table-view").attr('height','unset');
                        }
                    });

                    var kaimytable = table.render({
                        elem: "#datalist_kai",id: "datalist_kai"
                        ,data: res.data.kai,where: {}, page: false, height: '360',limit:9999999
                        ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
                        ,defaultToolbar: ['','',''],filter: TabInit.filter
                        ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
                        ,text: TabInit.text
                        ,parseData: function (res) {

                            render_from();
                            return {
                                "code": res.code,
                                "msg": res.message,
                                "count": res.data.data.total,
                                "data": res.data.data.data
                            };
                        }
                        , cols: [[
                            {type:'numbers',title:'序号',fixed:'left'}
                            ,{field:'name',title:'项目名称',templet: function(d){
                                    return '<span class="colorlan" onclick="openPage(\'../engin/show.php?id='+d.id+'\')">'+d.name+'</span>';
                                }}
                            ,{field: 'enddt_tou', title: '开标时间'}
                        ]]
                        , done: function (res) {
                            soulTable.render(this);
                            $(".layui-table-view").attr('height','unset');
                        }
                    });



                    render_from();
                }
            });
        }





    });




    $(".tipss_1").hover(function(){hhzhu_index = layer.tips('开标日期为当前年度的项目数量',this,{time:0});},function(){layer.close(hhzhu_index);});
    $(".tipss_2").hover(function(){hhzhu_index = layer.tips('开标日期为当前年度的项目的预计工程造价之和',this,{time:0});},function(){layer.close(hhzhu_index);});
    $(".tipss_3").hover(function(){hhzhu_index = layer.tips('开标日期为当前年度的中标项目数',this,{time:0});},function(){layer.close(hhzhu_index);});
    $(".tipss_4").hover(function(){hhzhu_index = layer.tips('开标日期为当前年度的中标项目的中标价之和',this,{time:0});},function(){layer.close(hhzhu_index);});
    $(".tipss_5").hover(function(){hhzhu_index = layer.tips('开标日期为当前年度的投标项目之数量和预计工程造价之和',this,{time:0});},function(){layer.close(hhzhu_index);});
    $(".tipss_6").hover(function(){hhzhu_index = layer.tips('开标日期为当前年度的自营项目、联营项目各自的数量和预计工程造价之和',this,{time:0});},function(){layer.close(hhzhu_index);});
    $(".tipss_7").hover(function(){hhzhu_index = layer.tips('当前年度中标的项目',this,{time:0});},function(){layer.close(hhzhu_index);});


















    function zi_chart_xmlxgczj(chat_id, data) {
        var mychat = echarts.init(document.getElementById(chat_id), 'dark');
        mychat.clear();
        option = {
            color: colors,
            backgroundColor: '#FFFFFF',
            tooltip: {
                trigger: 'item'
            },
            series: [
                {
                    name: '',
                    type: 'pie',
                    radius: '80%',
                    data: data,
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        mychat.setOption(option);
    }
    function zi_chart_xmsxgczj(chat_id, data) {
        var mychat = echarts.init(document.getElementById(chat_id), 'dark');
        mychat.clear();
        option = {
            color: colors,
            backgroundColor: '#FFFFFF',
            tooltip: {
                trigger: 'item'
            },
            series: [
                {
                    name: '',
                    type: 'pie',
                    radius: '80%',
                    data: data,
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        mychat.setOption(option);
    }
</script>
</body>
</html>
